# -*- coding: utf_8 -*-
from django.db import models

# Create your models here.

class employee(models.Model):
	
	status_option = (
		('0','在职'),
		('1','离职')
		)	

	deptno = models.CharField('部门编号',max_length=6,unique = True,primary_key=True)
	name = models.CharField('姓名',max_length=10)
	tel = models.CharField('电话',max_length=11)
	position = models.CharField('职位',max_length=10)
	hiretime = models.DateTimeField()
	status = models.CharField('状态',max_length=1,choices=status_option)

class department(models.Model):
	
	status_option = (
		('0','正常营业'),
		('1','站点关闭'),
		('3','暂时关闭'),
		)
        
	area_option = (
		('0','东部片区'),
		('1','中心片区'),
 		('2','西部片区'),
		)

	sales_department = (
		('sq','市区销售部'),
		('bj','布吉销售部'),
		('ba','宝安销售部'),
		('lh','龙华销售部'),
		('gm','光明销售部'),
		('lg','龙岗销售部'),
		('ph','平湖销售部'),
		)

	deptname = models.CharField('部门名称',max_length=10)
	deptno = models.CharField('部门编号',max_length=6,primary_key = True)
	pdeptno = models.CharField('部门编号',max_length=6)
	area = models.CharField('区域',max_length=10,choices = area_option)
	saledept = models.CharField('销售部',max_length=10,choices = sales_department)
	address = models.CharField('地址',max_length=20)
	tel = models.CharField('联系电话',max_length=11)
	remark = models.TextField('备注',max_length=11)
	status = models.CharField('状态',max_length=1,choices = status_option)

class business(models.Model):
	
	acc_option = (
		('st','三通'),
		('jg','胶管')
		)
	
	inv_option = (
		('yes','提供发票'),
		('no','不提供发票')
		)	
	
	deptno = models.ForeignKey(department)
	open_account = models.DateField('开户时间')
	order_attenttion = models.TextField('注意事项',max_length = 50)
	delivery_time = models.DateField('送气时间')
	delivery_range = models.TextField('送气区域',max_length = 100)
	accessories = models.CharField('配件',max_length = 10, choices = acc_option )
	invoice = models.CharField('发票管理',max_length = 20, choices = inv_option )

class GasBottle(models.Model):
	
	type_option = (
		('YSP26.2','YSP26.2'),
		('YSP35.5','YSP35.5'),
		('YSP118','YSP118'),
		)

	gas_type = models.CharField('钢瓶类型',max_length = 10, choices = type_option)
	price = models.CharField('价格',max_length = 5)
	pubtime = models.DateTimeField('发布时间')

	def __unicode__(self):
		return self.gas_type

class Knowledge(models.Model):
	
	type_option = (
		('0','服务脚本'),
		('1','政策'),
		('2','收费标准'),
		('3','抢修'),
		('4','优惠促销'),
		)

	status_option = (
		('0','发布'),
		('1','需修改'),
	)

	subject = models.CharField('主题',max_length = 5,choices = type_option)
	content = models.TextField('内容', max_length = 100, blank = True)
	marker = models.CharField('登记人',max_length = 5)
	status = models.CharField('状态',max_length = 5,choices = status_option)


